feat: support Array<ArrayBuffer> as a TurboModule method parameter - #58029
Open
paradowstack wants to merge 2 commits into
Open
feat: support Array<ArrayBuffer> as a TurboModule method parameter#58029paradowstack wants to merge 2 commits into
paradowstack wants to merge 2 commits into
Conversation
paradowstack
force-pushed
the
feat/codegen-array-of-arraybuffer
branch
from
August 20, 2026 13:20
d9c6943 to
26c2724
Compare
This was referenced Aug 20, 2026
paradowstack
force-pushed
the
feat/codegen-array-of-arraybuffer
branch
from
August 20, 2026 13:54
26c2724 to
9ffa67b
Compare
paradowstack
marked this pull request as ready for review
August 20, 2026 14:08
paradowstack
force-pushed
the
feat/codegen-array-of-arraybuffer
branch
from
August 21, 2026 06:41
9ffa67b to
127c367
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rebase Note:
This branch is stacked on #57937 (
Promise<ArrayBuffer>for Java/ObjC TurboModules) and must be rebased ontomainonce that lands. For now review only the last commit.Summary:
TurboModules could take a single
ArrayBuffer, but not a list of them.Array<ArrayBuffer>fell through to the generic array path and degraded silently toReadableArray/NSArray, so the buffers arrived as untyped array elements rather than as buffers.This adds
Array<ArrayBuffer>as a top-level method parameter. Codegen emitsArrayBuffer[]for the Java spec,[Lcom/facebook/react/bridge/ArrayBuffer;for the JNI signature, andNSArray<RCTArrayBuffer *> *for ObjC.Every other position — nested arrays, object properties, return types, Promise resolutions, callback parameters and returns, and event emitter payloads — now throws at codegen time instead of degrading silently, so a spec cannot compile into something that quietly loses its buffers. C++ TurboModules (
cxxOnly) deliberately skip the guard:Array<ArrayBuffer>degrades to a plainjsi::Arraythere, which is the right shape for a module that already works on raw JSI.Nullable elements are not supported.
Array<?ArrayBuffer>throws at codegen time, and the generators fall back to an untyped array if the guard is ever bypassed. Neither platform can honour it: anNSArraycannot holdnil, so iOS would have to deliverNSNullinside an array whose lightweight generic promisesRCTArrayBuffer *, and RN's Java codegen emitsjavax.annotation.Nullable, which is declaration-only and cannot annotate an array's element type.Changelog:
[GENERAL] [ADDED] - Support
Array<ArrayBuffer>as a TurboModule method parameterTest Plan:
error-utils-testcoversthrowIfUnsupportedArrayBufferArrayUsageand its event emitter counterpart..mmand C++ spec snapshots updated.RCTTurboModuleArrayBufferTests.mmadds five new tests.SampleTurboModule/RCTSampleTurboModuleaddarrayBufferArray.